home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
newsgroups
/
misc.20000824-20010305
/
000308_fdc@watsun.cc.columbia.edu_Mon Feb 19 09:41:23 EST 2001.msg
< prev
next >
Wrap
Text File
|
2001-03-05
|
4KB
|
81 lines
Article: 488154 of comp.os.linux.misc
Path: newsmaster.cc.columbia.edu!not-for-mail
From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
Newsgroups: comp.os.linux.misc,comp.protocols.kermit.misc
Subject: Re: using rm to delete thru the tree
Date: 19 Feb 2001 09:32:36 -0500
Organization: Columbia University
Lines: 64
Message-ID: <96raq4$pke@watsun.cc.columbia.edu>
References: <Pine.LNX.4.21.0102181824001.12961-100000@matrixuc.homeip.net> <z3_j6.124259$g6.60182676@news1.elmhst1.il.home.com> <96psu8$2dj$1@vizcacha.cox.rr.com>
NNTP-Posting-Host: watsun.cc.columbia.edu
X-Trace: newsmaster.cc.columbia.edu 982593158 823 128.59.39.2 (19 Feb 2001 14:32:38 GMT)
X-Complaints-To: postmaster@columbia.edu
NNTP-Posting-Date: 19 Feb 2001 14:32:38 GMT
Xref: newsmaster.cc.columbia.edu comp.os.linux.misc:488154 comp.protocols.kermit.misc:12171
In article <96psu8$2dj$1@vizcacha.cox.rr.com>,
Adrian Mariano <adrian@cox.rr.com> wrote:
: >"Sudhakar R." <ramasas@email.uc.edu> wrote in message
: >> could someone please tell me how to go about deleting all files that match
: >> the pattern *.*~ in every directory including sub-directories, sub-sub
: >> directories and so on in one single sweep.
: >
: "Benjamin Good" <bmg@metallica.com> writes:
:
: > rm -r is recursive delete. Be careful using it. See man rm.
:
: It's true that 'rm -r' is recursive delete but it will not do what was
: asked. It will recursively delete entire directories (and all their
: subdirectories). There is no way to get it to delete only certain
: files from the subdirectories.
:
A way to do this would be with the increasingly-all-purpose utility,
C-Kermit:
http://www.columbia.edu/kermit/ck71.html
If you want to delete all *.*~ files in the directory tree, the command is:
delete /recursive *.*~
Some people might find this a bit more intuitive than
find . -name \*.\*~ -exec rm -f {} \;
The C-Kermit 7.1 DELETE command has lots of flexibility as you can see
from its list of options:
C-Kermit>delete ? File specification;
or switch, one of the following:
/after: /except: /nodotfiles /recursive /type:
/ask /heading /noheading /simulate
/before: /larger-than: /nolist /smaller-than:
/directories /list /not-after: /summary
/dotfiles /noask /not-before: /tree
C-Kermit>
So if you wanted to delete recursively files whose names matched a certain
pattern that were older than a certain date and were bigger than X but
smaller than Y, except for a certain list of files, it's all there.
"delete /tree" is like "rm -Rf" or "deltree". "/simulate" lets you see
what would happen without actually doing it.
By the way, when you say *.*~, if you really mean EMACS-style backup files,
like foo.c.~3~, Kermit has a built-in command for that too: PURGE:
C-Kermit>purge ? Filename or switch, one of the following:
/after: /except: /list /nolist /page
/ask /heading /noask /nopage /recursive
/before: /keep: /nodotfiles /not-after: /simulate
/dotfiles /larger-than: /noheading /not-before: /smaller-than:
C-Kermit>
As you can see, this one can also be applied recursively, plus you can
tell it to keep a certain number of backup generations if you want. In your
case the command would be simply:
purge /recursive *.*
- Frank